

local mt = ac.skill['幻影突袭']
mt.range = 900
mt.targettype = '物体'
--mt.target_data = '自己|玩家单位|联盟'
mt.effect = [[war3mapImported\PhantomStrike.mdx]]
function mt:on_cast_shot()
    local hero = self.owner
    local target = self.target
    local point1 = hero:get_point()
    local point2 = target:get_point()
    point1:add_effect(self.effect):remove()
    if point2:is_flyable() then
        hero:set_point(point2)
    end
    hero:issue_order('stop')
    hero:add_buff '幻影突袭-加速'{data1 = self.data1,art = self.art}
end


local buff = ac.buff['幻影突袭-加速']
buff.tip = [[攻速提升！]]
buff.time = 3
buff.data = 100

function buff:on_add()
    local hero = self.owner
    self:gc(hero:add('攻击速度',self.data1))
end




local mt = ac.skill['恩赐解脱']
mt.model1 = [[a951555a3eb6823199f04cff540518fb.mdx]]
mt.temp = '攻击触发'

function mt:on_run(hero,target)
    local hero = self.owner
    local rate = 0
    if math.random(100)<=15 then
        rate = self.data1
    elseif math.random(100)<=8 then
        rate = self.data2
    elseif math.random(100)<=1 then
        rate = self.data3
    end
    if rate>0 then
        local damage = hero:get('攻击') * rate/100
        local point = target:get_point()
        local angle = hero:get_point() / point
        point:effect{
            model = self.model1,
            angle = angle,
            time = 0.2,
        }
        hero:create_damage(target,damage,self)
        ac.texttag {
            text = ('|cffff0000%s倍|n'):format(rate),
            font_size = 24,
            angle = 90,
            speed = 200,
            lifespan = 1,
            fadepoint = 1,
            target = hero,
        }
    end
end



local mt = ac.skill['飞镖']
mt.temp = '攻击触发'
mt.model1 = [[Abilities\Weapons\WardenMissile\WardenMissile.mdl]]

function mt:on_run(hero,target)
    local damage = hero:get('攻击') * self.data1/100 + hero:get('敏捷') * self.data2/100
    hero:launch_missile(target,self.model1,900,0,function()
        hero:create_damage(target,damage,self)
        if not target:is_alive() then
            local target = ac.selector('unit'):enemy(hero):range(hero,600):random()
            if target then
                self:on_run(hero,target)
            end
        end
    end)
end

